package com.pai.dao.AppUser;



import com.pai.entity.AppUser;
import com.pai.entity.vmodel.UserInfo;

import java.sql.Connection;
import java.util.List;

/**
 * 系统用户dao
 */
public interface AppUserDao {
    /**
     * 获取角色列表
     * @param connection
     * @return
     * @throws Exception
     */
    public List<AppUser> getList(Connection connection) throws Exception;

    /**
     * 新增角色
     * @param connection
     * @param item
     * @return
     * @throws Exception
     */
    public int add(Connection connection, AppUser item) throws Exception;


    /**
     * 获取角色详情
     * @param connection
     * @param id
     * @return
     * @throws Exception
     */
    public AppUser getItemDetail(Connection connection, String id) throws Exception;

    /**
     * 更新角色
     * @param connection
     * @param role
     * @return
     * @throws Exception
     */
    public int update(Connection connection, AppUser role) throws Exception;

    /**
     * 更新用户角色
     * @param connection
     * @param personnelId  用户id
     * @param roleName  要更新为什么角色
     * @return
     * @throws Exception
     */
    public int updateRole(Connection connection, String personnelId, String roleName) throws Exception;

    /**
     * 更新账号
     * @param connection
     * @param id  系统用户id主键
     * @param newAccount  新账号
     * @return
     * @throws Exception
     */
    public int updateAccount(Connection connection, String id, String newAccount) throws Exception;

    /**
     * 删除
     * @param connection
     * @param id
     * @return
     * @throws Exception
     */
    public int delete(Connection connection, String id) throws Exception;
    /**
     * 登录
     * @param connection
     * @param appUser
     * @return
     * @throws Exception
     */
    public AppUser login(Connection connection, AppUser appUser) throws Exception;

    /**
     * 根据账号获取用户信息
     * @param connection
     * @param account 账号
     * @return
     * @throws Exception
     */
    public UserInfo getUserInfo(Connection connection, String  account) throws Exception;
}
